import { router } from "./index";
import UserModel from '@/moduls/userModel';
import md5 from 'blueimp-md5';

// 修改密码
router.put('/manage/user/pwd',(req,res)=>{
  const _id = req.body.userId
  UserModel.findOne({_id:_id}).then(user=>{
      if(!user){
          return res.send({status:1,msg:'密码不正确'})
      }
      user.password = md5(req.body.password)
      UserModel.findByIdAndUpdate(_id,user).then(()=>{
          return res.send({status:0,msg:'修改密码成功'})
      })
  })
})